<template>
	<div class="c2">
		<h1>我是Child2组件</h1>
		<h3>我的手机是：{{phone}}</h3>
		<button @click="savePhone(phone)">把手机给我父亲</button>
		<Grandson @get-toy="passToy"/>
	</div>
</template>

<script>
	import Grandson from './Grandson.vue'

	export default {
		name:'Child2',
		components:{Grandson},
		props:['savePhone'],
		data() {
			return {
				phone:'华为p50'
			}
		},
		methods:{
			passToy(value){
				this.$emit('get-toy',value)
			}
		}
	}
</script>

<style>
	.c2{
		background-color: orange;
		padding: 20px;
	}
</style>